package com.zjyd.douyangsystem.service.impl;

import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 生产MQ
 */
@Service
public class MessageProducerService {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    /**
     * 给MQ发送信息
     * @param topic 主题
     * @param message 信息内容
     * @return 发送结果
     */
    public SendResult sendMessage(String topic, String message){
        return rocketMQTemplate.syncSend(topic,message);
    }
}
